Xbasic

ShortTime_Extract Function

Syntax

Result as N = ShortTime_Extract(Y shortTime ,C TimePart )

Arguments

Result

The number of time units specified in Time_Part.

shortTime

The short time value to analyze.

TimePart

The part of the short time value to return. "h" = hours, "m" = minutes, "s" = seconds

Description

Extracts hours, minutes, or seconds from a Short time value. TimePart is 'h', 'm', or 's'

Discussion

The ShortTime_Extract() function extracts the hours, minutes or seconds from a short time value.

Example

dim st as Y
st = ctot("8:32 45.345 pm")
  ? shortTime_extract(st,"h") 
= 20

  ? shortTime_extract(st,"m") 
= 32

  ? shortTime_extract(st,"s")
= 45.345
? if(shortTime_extract(st,"h") > 11, "pm",  "am")
= "pm"

See Also